import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: '/login',
        component: () =>
            import ('@/views/login')


    },
    {
        path: '/search',
        component: () =>
            import ('@/views/search')

    },
    {
        path: '/article/:articleId',
        component: () =>
            import ('@/views/article'),
        // 开启 Props 传参，说白了就是把路由参数映射到组件的 props 数据中
        props: true

    },
    {
        path: '/user/profile',
        name: 'user-profile',
        component: () =>
            import ('@/views/user-profile')
    }, {
        path: '/', // 根路径，默认进入布局页面
        component: () =>
            import ('@/views/layout'),
        children: [{
                path: '/home',
                component: () =>
                    import ('@/views/home'),
            },
            {
                path: '/my',
                component: () =>
                    import ('@/views/my'),
            }, {
                path: '/video',
                component: () =>
                    import ('@/views/video'),
            }, {
                path: '/wenda',
                component: () =>
                    import ('@/views/wenda'),
            }
        ]
    }
]
const router = new VueRouter({
    routes
})

export default router